package org.xmdl.silk.wrap;

import org.xmdl.silk.Expression;
import org.xmdl.silk.ParaGroup;
import org.xmdl.silk.impl.ParaGroupImpl;
import org.xmdl.silk.visit.Visitor;

public class ParaGroupWrap extends ParaGroupImpl implements ParaGroup, ExpressionWrap {

	private final ParaGroup w;
	private Expression v;

	public ParaGroupWrap(ParaGroup w) {
		this.w = w;
		v = WrapUtils.expression(w.getValue());
	}

	@Override
	public Expression getValue() {
		return v;
	}

	@Override
	public void setValue(Expression newValue) {
		w.setValue(newValue);
	}

	public boolean accept(Visitor visitor) {
		if (visitor.visitEnter(this)) {
			Expression val = getValue();
			((Wrapped) val).accept(visitor);
		}
		boolean result = visitor.visitLeave(this);
		return result;
	}

}
